package com.yic.module.device.dal.mysql.inspectionPlanMessage;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.inspectionPlanMessage.InspectionPlanMessageDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.inspectionPlanMessage.vo.*;

/**
 * 设备计划消息管理 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface InspectionPlanMessageMapper extends BaseMapperX<InspectionPlanMessageDO> {

    default PageResult<InspectionPlanMessageDO> selectPage(InspectionPlanMessagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InspectionPlanMessageDO>()
                .eqIfPresent(InspectionPlanMessageDO::getMessage, reqVO.getMessage())
                .eqIfPresent(InspectionPlanMessageDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InspectionPlanMessageDO::getSendUserId, reqVO.getSendUserId())
                .eqIfPresent(InspectionPlanMessageDO::getTargetUserId, reqVO.getTargetUserId())
                .eqIfPresent(InspectionPlanMessageDO::getContent, reqVO.getContent())
                .betweenIfPresent(InspectionPlanMessageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionPlanMessageDO::getId));
    }

    default List<InspectionPlanMessageDO> selectList(InspectionPlanMessageExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InspectionPlanMessageDO>()
                .eqIfPresent(InspectionPlanMessageDO::getMessage, reqVO.getMessage())
                .eqIfPresent(InspectionPlanMessageDO::getStatus, reqVO.getStatus())
                .eqIfPresent(InspectionPlanMessageDO::getSendUserId, reqVO.getSendUserId())
                .eqIfPresent(InspectionPlanMessageDO::getTargetUserId, reqVO.getTargetUserId())
                .eqIfPresent(InspectionPlanMessageDO::getContent, reqVO.getContent())
                .betweenIfPresent(InspectionPlanMessageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InspectionPlanMessageDO::getId));
    }

}
